package com.shrct.businessprocess.product.impl;

import com.shrct.businessprocess.organization.RCEnterprise;
import com.shrct.businessprocess.organization.RCSupplier;
import com.shrct.businessprocess.organization.impl.RCEnterpriseImpl;
import com.shrct.businessprocess.organization.impl.RCSupplierImpl;
import com.shrct.businessprocess.product.RCProductEntry;
import com.shrct.businessprocess.product.RCProductSpecification;
import com.shrct.businessprocess.product.impl.RCProductSpecificationImpl;
import com.shrct.businessprocess.product.proxy.RCProductEntryProxy;
import edu.fudan.mylang.pf.BaseModelObject;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("RCPRODUCTENTRY_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "rcproductentry")
public abstract class RCProductEntryImpl extends BaseModelObject implements RCProductEntry {
  public RCProductEntryImpl() {
    super();
  }
  
  private String projectId;
  
  public String getProjectId() {
    return this.projectId;
  }
  
  public RCProductEntry setProjectId(final String projectId) {
    this.projectId = projectId;
    return this;			
    
  }
  
  @JoinColumn(name = "enterprise_id")
  @ManyToOne(targetEntity = RCEnterpriseImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCEnterprise enterprise;
  
  public RCEnterprise getEnterprise() {
    return this.enterprise;
  }
  
  public RCProductEntry setEnterprise(final RCEnterprise enterprise) {
    this.enterprise = enterprise;
    return this;			
    
  }
  
  private String location;
  
  public String getLocation() {
    return this.location;
  }
  
  public RCProductEntry setLocation(final String location) {
    this.location = location;
    return this;			
    
  }
  
  private String branch;
  
  public String getBranch() {
    return this.branch;
  }
  
  public RCProductEntry setBranch(final String branch) {
    this.branch = branch;
    return this;			
    
  }
  
  @JoinColumn(name = "supplier_id")
  @ManyToOne(targetEntity = RCSupplierImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCSupplier supplier;
  
  public RCSupplier getSupplier() {
    return this.supplier;
  }
  
  public RCProductEntry setSupplier(final RCSupplier supplier) {
    this.supplier = supplier;
    return this;			
    
  }
  
  @JoinColumn(name = "type_id")
  @ManyToOne(targetEntity = RCProductSpecificationImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCProductSpecification type;
  
  public RCProductSpecification getType() {
    return this.type;
  }
  
  public RCProductEntry setType(final RCProductSpecification type) {
    this.type = type;
    return this;			
    
  }
  
  private String sid;
  
  public String getSid() {
    return this.sid;
  }
  
  public RCProductEntry setSid(final String sid) {
    this.sid = sid;
    return this;			
    
  }
  
  private String normalizedSid;
  
  public String getNormalizedSid() {
    return this.normalizedSid;
  }
  
  public RCProductEntry setNormalizedSid(final String normalizedSid) {
    this.normalizedSid = normalizedSid;
    return this;			
    
  }
  
  public RCProductEntryProxy toProxy() {
    com.shrct.businessprocess.product.proxy.RCProductEntryProxy proxy = new com.shrct.businessprocess.product.proxy.RCProductEntryProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
